import { VxeFormItemProps, VxeGridPropTypes } from '@gui-pkg/antdcomponents';
import { h } from 'vue';
import { Switch } from 'ant-design-vue';
import { useMessage } from '@/hooks/web/useMessage';
import { changeRoleStatus } from '@/api/system/role';

export const columns: VxeGridPropTypes.Columns = [
  {
    title: '操作人员',
    field: 'operName',
    align: 'center',
  },
  {
    title: '操作IP',
    field: 'operIp',
    align: 'center',
  },{
    title: '模块名称',
    field: 'title',
    align: 'center',
    fixed: 'left',
  },

  {
    title: '操作时间',
    field: 'operTime',
    align: 'center',
  },
  {
    title: '操作API',
    field: 'operUrl',
  },
  {
    title: '响应结果',
    field: 'jsonResult',
    align: 'center',
  },
];

export const searchFormSchema: VxeFormItemProps[] = [
  {
    field: 'operName',
    title: '操作人员',
    itemRender: {
      name: 'AInput',
    },
    span: 6,
  },
  {
    field: 'operTime',
    title: '操作时间',
    itemRender: {
      name: 'ARangePicker',
      props: {
        valueFormat: 'YYYY-MM-DD',
      }
    },
    span: 6,
  },
  {
    span: 12,
    align: 'right',
    className: '!pr-0',
    itemRender: {
      name: 'AButtonGroup',
      children: [
        {
          props: { type: 'primary', content: '查询', htmlType: 'submit' },
          attrs: { class: 'mr-2' },
        },
        { props: { type: 'default', htmlType: 'reset', content: '重置' } },
      ],
    },
  },
];

export const formSchema = [
  {
    field: 'roleName',
    label: '角色名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'roleKey',
    label: '角色编码',
    required: true,
    component: 'Input',
  },
  {
    field: 'roleSort',
    label: '排序',
    defaultValue: 1,
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'status',
    label: '状态',
    component: 'RadioButtonGroup',
    defaultValue: '0',
    componentProps: {
      options: [
        { label: '启用', value: '0' },
        { label: '停用', value: '1' },
      ],
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    label: ' ',
    field: 'menus',
    slot: 'menu',
    component: 'Input',
  },
];
